/**
 * Arduino两轮小车
 * 
 * 本程序可不受限制的用于学习和教学，商业用途请联系作者。
 * 本程序不对用户因使用程序而造成任何形式的损失负责。
 * 
 * site: http://www.xpstem.com/maker/arduino-vehicle
 * author: billy zhang
 */
 
#include <Arduino.h>
#include "InfraredReceiver.h"

void InfraredReceiver::setup()
{
//  irrecv_.enableRecv();
}

void InfraredReceiver::receive()
{
  if (irrecv_.decode(&results_)) {
    Serial.println(results_.value, HEX);
    irrecv_.resume();
    if (results_.value == 0xFF18E7) {
      forwardPressState_ = 1;
    } else if (results_.value == 0xFF4AB5) {
      backwardPressState_ = 1;
    } else if (results_.value == 0xFF10EF) {
      leftPressState_ = 1;
    } else if (results_.value == 0xFF5AA5) {
      rightPressState_ = 1;
    } else if (results_.value == 0xFF38C7) {
      stopPressState_ = 1;
    }
  }
}

InfraredReceiver::~InfraredReceiver()
{
}
